<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
    <title>代理商管理系统</title>
    <link rel="stylesheet" type="text/css" href="${ctx}/statics/easyui/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="${ctx}/statics/easyui/themes/icon.css" />
    <link rel="stylesheet" type="text/css" href="${ctx}/statics/easyui/themes/color.css" />
    <link rel="stylesheet" type="text/css" href="${ctx}/statics/easyui/themes/demo.css" />
    <script src="${ctx}/statics/easyui/jquery.min.js" type="text/javascript"></script>
    <script src="${ctx}/statics/easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="${ctx}/statics/easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
</head>
<body class="easyui-layout" >
    <form id="view" >
        <div data-options="region:'north',split:false" style="height:150px;background:#eee;padding:10px 20px 10px 20px">
            <div style="padding-left:10px;margin-bottom:10px"><h5 style="margin:0">基本信息</h5></div>
            <div style="border:1px solid lightgrey;padding-left:10px">
                <p>
                    <span style="width:60px;text-align:justify;display:inline-block">
                        企业名称:
                    </span>
                    <input class="easyui-textbox" type="text" name="customName" style="width:150px;" readonly />
                    <span style="margin-left:150px;width:60px;text-align:justify;display:inline-block">企业类型:</span>
                    <input class="easyui-textbox" name="customTypeName" style="width:150px" readonly />
                </p>
                <p style="margin-top:20px">
                    <span style="width:60px;text-align:justify;display:inline-block">
                        企业主页:
                    </span>
                    <input class="easyui-textbox" type="text" name="siteUrl" style="width:150px;" readonly/>
                    <span style="margin-left:150px;width:60px;text-align:justify;display:inline-block">
                        状态:
                    </span>
                    <input class="easyui-textbox" type="text" name="customStatus" style="width:150px;" readonly/>
                </p>
            </div>
        </div>
        <div data-options="region:'south',split:false" style="height:130px;background:#eee;padding:10px">
            <p style="text-align:center;margin-top:70px">
                <a href="javascript:void(0)" class="easyui-linkbutton c6"
                   onclick="cancel()" style="width:60px;">返回</a>
            </p>
        </div>
        <div data-options="region:'center',split:false" style="background:#eee;padding:10px 20px 10px 20px">
            <div style="padding-left:10px;margin-bottom:10px"><h5 style="margin:0">门户信息</h5></div>
            <div style="border:1px solid lightgrey;padding-left:10px">
                <p>
                    <span style="width:60px;text-align:justify;display:inline-block">
                        法人代表:
                    </span>
                    <input class="easyui-textbox" type="text" name="bossName" style="width:150px;" readonly />
                    <span style="margin-left:150px;width:60px;text-align:justify;display:inline-block">
                        注册日期:
                    </span>
                    <input type="text" class="easyui-textbox" name="regDatetime" style="width:150px;" readonly />
                </p>
                <p style="margin-top:20px">
                    <span style="width:60px;text-align:justify;display:inline-block">
                        证件类型:
                    </span>
                    <input name="cardTypeName" style="width:150px" readonly />
                    <span style="margin-left:150px;width:60px;text-align:justify;display:inline-block">
                        证件号码:
                    </span>
                    <input class="easyui-textbox" type="text" name="cardNum" style="width:150px;" readonly />
                </p>
                <p style="margin-top:20px">
                    <span style="width:60px;text-align:justify;display:inline-block">
                        公司电话:
                    </span>
                    <input class="easyui-textbox" type="text" name="companyTel" style="width:150px;" readonly />
                    <span style="margin-left:150px;width:60px;text-align:justify;display:inline-block">
                        公司传真:
                    </span>
                    <input class="easyui-textbox" type="text" name="companyFax" style="width:150px;" readonly />
                </p>
                <p style="margin-top:20px">
                    <span style="width:60px;text-align:justify;display:inline-block">
                        国家:
                    </span>
                    <input class="easyui-textbox" type="text" name="country" style="width:150px;" readonly />
                    <span style="margin-left:150px;width:60px;text-align:justify;display:inline-block">
                        公司地址:
                    </span>
                    <input class="easyui-textbox" type="text" name="companyAddress" style="width:150px;" readonly />
                </p>
                <p style="margin-top:20px">
                    <span>
                        省/地区:
                    </span>
                    <input id="province" class="easyui-textbox" type="text" name="province" style="width:150px" readonly />
                    <span style="margin-left:45px;">
                        城市:
                    </span>
                    <input id="city" class="easyui-textbox" type="text" name="city" style="width:150px" readonly />
                    <span style="margin-left:45px;">
                        区:
                    </span>
                    <input id="area" class="easyui-textbox" type="text" name="area" style="width:150px" readonly />
                </p>
                <p>
                    <span style="display:block">备注</span>
                    <textarea name="memo" rows="5" cols="100" readonly></textarea>
                </p>
            </div>
        </div>
    </form>

    <script>
        $(
            function ()
            {
                //首先发送查询该用户
                var customId = parseInt( ${requestScope.customId} );
                //发送请求查询客户信息
                $.ajax(
                    {
                        type:"POST",
                        url:"${ctx}/do/selectCustom",
                        data:{"customId":customId},
                        dataType:"json",
                        success:function ( json )
                        {
                            //发送请求获取该用户的一组省市区
                            $.ajax(
                                {
                                    url:"${ctx}/do/provinceCityArea",
                                    type:"POST",
                                    data:{"provinceId":json.province,"cityId":json.city,"areaId":json.area},
                                    dataType:"json",
                                    success:function( name )
                                    {
                                        $("#province").textbox('setText',name.province);
                                        $("#city").textbox('setText',name.city);
                                        $("#area").textbox('setText',name.area);
                                    }
                                }
                            );
                            //根据查询结果设置表单数据
                            $("#view").form( 'load' ,
                                {
                                    customName:json.customName,
                                    siteUrl:json.siteUrl,
                                    bossName:json.bossName,
                                    regDatetime:json.regDatetime,
                                    cardNum:json.cardNum,
                                    companyTel:json.companyTel,
                                    companyFax:json.companyFax,
                                    country:json.country,
                                    companyAddress:json.companyAddress,
                                    memo:json.memo,
                                    customStatus:(json.customStatus?"启用":"未启用"),
                                    customType:json.customType,
                                    cardType:json.cardType,
                                    customTypeName:json.customTypeName,
                                    cardTypeName:json.cardTypeName
                                });
                        }
                    }
                )
            }
        );

        //点击取消按钮返回客户管理页面
        function cancel()
        {
            window.location.href = "${ctx}/do/toAgentCustomManagePage";
        }
    </script>
</body>
</html>
